<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
  <title>Speech Parrot Page</title>
  <script type="text/javascript" src="lib/speechapi.js"></script>
  <script type="text/javascript" src="lib/swfobject.js"></script>
  <script language="JavaScript" type="text/javascript" >


        function onLoaded() {
  		speechapi.setupRecognition("SIMPLE", document.getElementById('words').value,false);
	}

	var flashvars = {speechServer : "rtmp://www.speechapi.com:1935/firstapp"};
        var params = {allowscriptaccess : "always"};
	var attributes = {};
	attributes.id = "flashContent";
	swfobject.embedSWF("lib/speechapi.swf", "myAlternativeContent", "215", "138", "9.0.28", false,flashvars, params, attributes);
	speechapi.setup("eli","password",onResult, 
			onFinishTTS, onLoaded, "flashContent");


	function onResult(result) {
		document.getElementById('answer').innerHTML = result.text;
		speechapi.speak(result.text,"male");
	}

	function onFinishTTS() {
		//alert("finishTTS");
	}
	function ResetGrammar() {
		speechapi.setupRecognition("SIMPLE", document.getElementById('words').value,false);
	}	
</script>

</head>
<body>
<h4>Parrot Demo</h4>
<p>First you will need to allow access to your microphone in the "Adobe Flash Player Settings" popup. Then hold the "press to speak" button and say a number 
between one and ten.  Release the button when you are done speaking.  If you are in a quiet environment or have a headset, try to enable automatic speech
detection mode.  When automatic mode is enabled, you do not need to press to speak; the system will detect speech for you.  You can also change the grammars
by modifying the comma separated list in the text entry field.</p>

<br>
<table border="1" width=>
<tr>
  <td>Words</td>
  <td><input type="text" id="words" value="one,two,three,four,five,six,seven,eight,nine,ten" size="100"/><input type="button" value="Reset Grammar" onclick="ResetGrammar()"></td>
</tr>
<tr>
  <td>RESULT</td>
  <td><b id='answer'></b></td>
</table>
<br>


<div id="myAlternativeContent"></div>
<div id="flashContent"></div>



</body>
</html>
